package com.fjl;

import com.fjl.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.core.DebuggingClassWriter;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.transaction.annotation.Transactional;

public class TestSpringTransactional {
	public static void main(String[] args) {
//		ApplicationContext ac = new AnnotationConfigApplicationContext("com.fjl");
		System.setProperty(DebuggingClassWriter.DEBUG_LOCATION_PROPERTY, "cglib_classes");

		ApplicationContext ac = new AnnotationConfigApplicationContext(ConfigApp.class);
		try {

			TestService bean = ac.getBean(TestService.class);
			bean.test();

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
class A{

	public void testA(){
		testB();
	}
	@Transactional
	public void testB(){

	}

}
class B{
	@Autowired A a;
	public void test(){
		a.testA();
	}
}